<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>商品修改页- ${web.name}${web.additionalTitle!}</title>
<link href="${base}/res/jeecore/css/theme.css" rel="stylesheet" type="text/css"/>
<link href="${root}/u/css/main.css" type="text/css" rel="stylesheet" />
<link href="${root}/u/css/memeber.css" type="text/css" rel="stylesheet" />
<link href="${sysResRoot}/front.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/common/css/jquery.ui.css" rel="stylesheet" type="text/css"/>
<link href="${root}/u/css/reset-min.css" type="text/css" rel="stylesheet" />
<script src="${base}/thirdparty/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="${base}/thirdparty/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery_ext.js" type="text/javascript"></script>
<script src="${base}/res/common/js/pony.js" type="text/javascript"></script>
<script src="${base}/res/common/js/pony.tree.js" type="text/javascript"></script>
<script src="${base}/res/jspgou/js/jquery.idTabs.min.js" type="text/javascript"></script>

<script src="${base}/thirdparty/swfupload/swfupload.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/swfupload.queue.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/fileprogress.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/handlers.js" type="text/javascript"></script>
<link href="${base}/thirdparty/swfupload/process.css" rel="stylesheet" type="text/css"/>

<script type="text/javascript">
function g(o){
	return document.getElementById(o);
}
function HoverLi(m,n,counter){
	for(var i=1;i<=counter;i++){
		g('tb_'+m+i).className='normaltab3';
		g('tbc_'+m+i).className='undis';
	}
	g('tbc_'+m+n).className='dis';
	g('tb_'+m+n).className='curr3';
}
function clickchange(i){
	$("input[id^='isDefaultes']").each(function(){
           $(this).val(false);
	});
	$("#isDefaultes"+i).val(true);
}
function jsSelectIsExitItem(objSelect, objItemValue) {        
    var isExit = true;        
    for (var i = 0; i < objSelect.options.length; i++) {        
        if (objSelect.options[i].value == objItemValue) {        
            isExit = false;        
            break;        
        }        
    }        
    return isExit;        
}   

function getList(){
    var list =""; 
    for(i=0;i<document.getElementById("correlationIds").length;i++){   
        list += document.getElementById("correlationIds").options(i).value+","; 
    } 
    document.getElementById("rightlist").value =list; 
}
function getcombinationList(){
    var list =""; 
    for(i=0;i<document.getElementById("combinationIds").length;i++){   
        list += document.getElementById("combinationIds").options(i).value+","; 
    } 
    document.getElementById("combinationrightlist").value =list; 
}

$(function() {
	$("#jvForm").validate();
	
	var uploadPicsUrl = "${base}/store/o_swfPicsUpload.jspx";
	//在firefox、chrome下，上传不能保留登录信息，所以必须加上jsessionid。
	var jsessionid = $.cookie("JSESSIONID");
	if(jsessionid) {
		uploadPicsUrl += ";jsessionid="+jsessionid;
	}
	
	swfu=new SWFUpload({
		upload_url : uploadPicsUrl,
		flash_url : "${base}/thirdparty/swfupload/swfupload.swf",
		file_size_limit : "20 MB",
		file_types : "*.jpg;*.gif;*.png;*.bmp",
		file_types_description : "图片集",
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "fsUploadProgress",
			cancelButtonId : "btnCancel"
		},
		debug: false,
		
		button_image_url : "${base}/res/common/img/theme/menu_search.jpg",
		button_placeholder_id : "spanButtonPlaceHolder",
		button_text: "<span class='btnText'>批量上传</span>",
		button_width: 52,
		button_height: 19,
		button_text_top_padding: 2,
		button_text_left_padding: 0,
		button_text_style: '.btnText{color:#666666;}',
		
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadPicsSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete
	});
	
	$('#add').click(function() {
	    //获取选中的选项，删除并追加给对方
	        $('#select option:selected').appendTo('#correlationIds');
	        getList();
	});
	 //移到左边
    $('#remove').click(function() {
        $('#correlationIds option:selected').appendTo('#select'); 
        getList();
    });
    //全部移到右边
    $('#add_all').click(function() {
        //获取全部的选项,删除并追加给对方
        $('#select option').appendTo('#correlationIds');
        getList();
    });
    //全部移到左边
    $('#remove_all').click(function() {
        $('#correlationIds option').appendTo('#select');
        getList();
    });
    //双击选项
    $('#select').dblclick(function(){ //绑定双击事件
        //获取全部的选项,删除并追加给对方
        $("option:selected",this).appendTo('#correlationIds'); //追加给对方
        getList();
    });
    //双击选项
    $('#correlationIds').dblclick(function(){
       $("option:selected",this).appendTo('#select');
       getList();
    });
    
    $('#combinationadd').click(function() {
	    //获取选中的选项，删除并追加给对方
	        $('#combinationselect option:selected').appendTo('#combinationIds');
	        getcombinationList();
	});
	 //移到左边
    $('#combinationremove').click(function() {
        $('#combinationIds option:selected').appendTo('#combinationselect'); 
        getcombinationList();
    });
    //全部移到右边
    $('#combinationadd_all').click(function() {
        //获取全部的选项,删除并追加给对方
        $('#combinationselect option').appendTo('#combinationIds');
        getcombinationList();
    });
    //全部移到左边
    $('#combinationremove_all').click(function() {
        $('#combinationIds option').appendTo('#select');
        getcombinationList();
    });
    //双击选项
    $('#combinationselect').dblclick(function(){ //绑定双击事件
        //获取全部的选项,删除并追加给对方
        $("option:selected",this).appendTo('#combinationIds'); //追加给对方
        getcombinationList();
    });
    //双击选项
    $('#combinationIds').dblclick(function(){
       $("option:selected",this).appendTo('#combinationselect');
       getcombinationList();
    });
	if(top.location.href.toLowerCase() == self.location.href.toLowerCase()) $('#docLink').show();
	$("#tabNav ul").idTabs("tab1"); 

	//栏目权限对话框
	$("#channelDialog").dialog({
		autoOpen: false,
		modal: true,
		width: 420,
		height: 420,
		position: ["center",20],
		buttons: {
			"确定": function() {
				$(this).dialog("close");
			}
		},
		close: function(event, ui) {
			var names =new Array([#list standardTypeList as standardType]new Array()[#if standardType_has_next],[/#if][/#list]);
			var ids=new Array([#list standardTypeList as standardType]new Array()[#if standardType_has_next],[/#if][/#list]);
			var index=0;
			[#list standardTypeList as standardType]
		    $("#${standardType.field}Container").css("display","");	
			$("#${standardType.field}ItemContainer").html("");
			[#if standardType.dataType]
			var tableContent="<tr>";
			$("input[name='${standardType.field}']:checked").each(function(){tableContent+="<td align='center'><input type='checkbox' id='${standardType.field}size' name='picture' onclick='standardAdd(this);'"+"value='"+$(this).val()+"'nameAttr='"+$(this).attr("nameAttr")+"' checked='checked'/>"+$(this).attr("nameAttr")+"</td>";});tableContent+="</tr><tr>";
			$("input[name='${standardType.field}']:checked").each(function(){
				tableContent+="<td align='center'><div>";
				tableContent+="<img id='preImg"+index+"' alt='43*43' style='width:100px;height:100px;background-color:#CCCCCC;border:1px solid #333'/><br/>";
				tableContent+="<input type='text' id='uploadImgPath"+index+"' name='colorImg' size='10'/><br/>"+
               "<span id='ufc"+index+"'><input type='file' id='uploadFile"+index+"' size='2'/></span> "+
               "<input type='hidden' id='zoomWidth"+index+"' value='100'/> "+
               "<input type='hidden' id='zoomHeight"+index+"' value='100' />"+ 
               " <input type='button' value='上传' onclick='upload("+index+");'/></div></td>";
				index++;
			});
			tableContent+="</tr>";	
			$("#${standardType.field}ItemContainer").append(tableContent);
			[#else]
			$("input[name='${standardType.field}']:checked").each(function(){$("#${standardType.field}ItemContainer").append("<input type='checkbox' id='${standardType.field}size' name='character' onclick='standardAdd(this);'"+"value='"+$(this).val()+"'nameAttr='"+$(this).attr("nameAttr")+"' checked='checked'/>"+$(this).attr("nameAttr"));});
			[/#if]
			[/#list]
			$("#onlyFashion").css("display",""); 
			var len=0;
			[#list standardTypeList as standardType]
				[#if standardType_index=0]
				len += $("input[id='${standardType.field}size']:checked").length;
				[#else]
				len = len*($("input[id='${standardType.field}size']:checked").length);
				[/#if]
			[/#list]
			var tableSpec=new Array();
			var dtable=document.getElementById("tableSpec");
			var rowNum=dtable.rows.length;
			for(var k=0;k<rowNum;k++) {
				tableSpec.push(dtable.rows[k].id);
			} 
			if(len==0){
				for(var kk=rowNum-1;kk>=0;kk--){
			    	if(dtable.rows[kk].id!="it"&&dtable.rows[kk].id!="tbeSpec"){
			        	$("#"+dtable.rows[kk].id).remove();
			        }
				}
				$("#onlyFashion").css("display","none"); 
			}else{
				[#list standardTypeList as standardType]
				    $("input[id='${standardType.field}size']:checked").each(function(){names[${standardType_index}].push($(this).attr("nameAttr"));ids[${standardType_index}].push($(this).val());});
			    [/#list]
				var tbeSpec="";
					for(var i=0;i<len;i++){
						var x =1;
						var m;
						var str=""
							for(var j = 0; j < ${standardTypeList?size}; j++){
								x = x * (names[j].length);
							    m =parseInt(i/(len/x));
							    if(j==0){
							    	str=ids[j][m%(names[j].length)];
								}else{
									str=str+"_"+ids[j][m%(names[j].length)];
								}
								
						    }
						var temp=1;
						var n;
						var pd=false;
						for(var zz=0;zz<tableSpec.length;zz++){
				   			if(tableSpec[zz]=="item_"+str){pd=true;}
						}
						if(!pd){
							tbeSpec +="<tr id='item_"+str+"'>";
							tbeSpec +="<td align='center' width='60'>";
							tbeSpec +="<input type='radio'  name='checkDefaults' onclick='clickchange("+'"'+str+'"'+")' />";
							tbeSpec +="<input type='hidden' id='isDefaultes"+str+"' name='isDefaults' value='false'/>";
							tbeSpec +="<input type='hidden' name='nature' value='"+str+"'/></td>";
							for(var j = 0; j < ${standardTypeList?size}; j++){
								temp = temp * (names[j].length);
							    n =parseInt(i/(len/temp));
								tbeSpec +="<td align='center' width='100'>"+names[j][n%(names[j].length)]+"</td>";
						    }				    
							tbeSpec +="<td align='center' width='120'><input name='stockCounts' type='text' onchange='addStocks();' size='10' value='0' class='required digits'/></td>";
							tbeSpec +="<td align='center' width='120'><input name='salePrices' type='text' size='10' class='required number'/></td>";
							tbeSpec +="<td align='center' width='120'><input name='marketPrices' type='text' size='10' class='required number'/></td>";
							tbeSpec +="<td align='center' width='120'><input name='costPrices' type='text' size='10' class='required number'/></td>";
							tbeSpec +="<td align='center' width='40'><img src='../../../res/jspgou/img/admin/icon_delete.gif' onclick='deleteItem(this);'/></td></tr>";
						}
					}
				$("#tbeSpec").before(tbeSpec);
				var rowNum1=dtable.rows.length;
				var tableSpec1=new Array();
				for(k=0;k<rowNum1;k++) {
					tableSpec1.push(dtable.rows[k].id);
				} 
				for(zz=rowNum1-1;zz>=0;zz--){
					var ppd=false;
					if(tableSpec1[zz]=="it"){
						 ppd=true;
					}else if(tableSpec1[zz]=="tbeSpec"){
						 ppd=true;
					}else{
					   for(i=0;i<len;i++){
						   var x =1;
							var m;
							var str=""
								for(var j = 0; j < ${standardTypeList?size}; j++){
									x = x * (names[j].length);
								    m =parseInt(i/(len/x));
								    if(j==0){
								    	str=ids[j][m%(names[j].length)];
									}else{
										str=str+"_"+ids[j][m%(names[j].length)];
									}
									
							    }
							if(tableSpec1[zz]=="item_"+str){
								ppd=true;
							}
					   }
				    }
				    if(!ppd){$("#"+tableSpec1[zz]).remove();}
			    }
			}
		}
	});
	var channels_opened = false;
	$('#channel').click(function(){
		//第一次打开，需要获取数据。
		if(!channels_opened) {
			//获取数据
			channels_opened = true;
		}
		$('#channelDialog').dialog('open');
		return false;
	});	
});


function standardAdd(checkname){
	$("#onlyFashion").css("display",""); 
	var len=0;
	[#list standardTypeList as standardType]
		[#if standardType_index=0]
		len += $("input[id='${standardType.field}size']:checked").length;
		[#else]
		len = len*($("input[id='${standardType.field}size']:checked").length);
		[/#if]
	[/#list]
	var names =new Array([#list standardTypeList as standardType]new Array()[#if standardType_has_next],[/#if][/#list]);
	var ids=new Array([#list standardTypeList as standardType]new Array()[#if standardType_has_next],[/#if][/#list]);
	var tableSpec=new Array();
	var dtable=document.getElementById("tableSpec");
	var rowNum=dtable.rows.length;
	for(var k=0;k<rowNum;k++) {
		tableSpec.push(dtable.rows[k].id);
	} 
	if(len==0){
		for(var kk=rowNum-1;kk>=0;kk--){
	    	if(dtable.rows[kk].id!="it"&&dtable.rows[kk].id!="tbeSpec"){
	        	$("#"+dtable.rows[kk].id).remove();
	        }
		}
		$("#onlyFashion").css("display","none"); 
	}else{
		[#list standardTypeList as standardType]
		    $("input[id='${standardType.field}size']:checked").each(function(){names[${standardType_index}].push($(this).attr("nameAttr"));ids[${standardType_index}].push($(this).val());});
	    [/#list]
		var tbeSpec="";
			for(var i=0;i<len;i++){
				var x =1;
				var m;
				var str=""
					for(var j = 0; j < ${standardTypeList?size}; j++){
						x = x * (names[j].length);
					    m =parseInt(i/(len/x));
					    if(j==0){
					    	str=ids[j][m%(names[j].length)];
						}else{
							str=str+"_"+ids[j][m%(names[j].length)];
						}
						
				    }
				var temp=1;
				var n;
				var pd=false;
				for(var zz=0;zz<tableSpec.length;zz++){
		   			if(tableSpec[zz]=="item_"+str){pd=true;}
				}
				if(!pd){
					tbeSpec +="<tr id='item_"+str+"'>";
					tbeSpec +="<td align='center' width='60'>";
					tbeSpec +="<input type='radio'  name='checkDefaults' onclick='clickchange("+'"'+str+'"'+")' />";
					tbeSpec +="<input type='hidden' id='isDefaultes"+str+"' name='isDefaults' value='false'/>";
					tbeSpec +="<input type='hidden' name='nature' value='"+str+"'/></td>";
					for(var j = 0; j < ${standardTypeList?size}; j++){
						temp = temp * (names[j].length);
					    n =parseInt(i/(len/temp));
						tbeSpec +="<td align='center' width='100'>"+names[j][n%(names[j].length)]+"</td>";
				    }				    
					tbeSpec +="<td align='center' width='120'><input name='stockCounts' type='text' onchange='addStocks();' size='10' value='0' class='required digits'/></td>";
					tbeSpec +="<td align='center' width='120'><input name='salePrices' type='text' size='10' class='required number'/></td>";
					tbeSpec +="<td align='center' width='120'><input name='marketPrices' type='text' size='10' class='required number'/></td>";
					tbeSpec +="<td align='center' width='120'><input name='costPrices' type='text' size='10' class='required number'/></td>";
					tbeSpec +="<td align='center' width='40'><img src='../../../res/jspgou/img/admin/icon_delete.gif' onclick='deleteItem(this);'/></td></tr>";
				}
			}
		$("#tbeSpec").before(tbeSpec);
		var rowNum1=dtable.rows.length;
		var tableSpec1=new Array();
		for(k=0;k<rowNum1;k++) {
			tableSpec1.push(dtable.rows[k].id);
		} 
		for(zz=rowNum1-1;zz>=0;zz--){
			var ppd=false;
			if(tableSpec1[zz]=="it"){
				 ppd=true;
			}else if(tableSpec1[zz]=="tbeSpec"){
				 ppd=true;
			}else{
			   for(i=0;i<len;i++){
				   var x =1;
					var m;
					var str=""
						for(var j = 0; j < ${standardTypeList?size}; j++){
							x = x * (names[j].length);
						    m =parseInt(i/(len/x));
						    if(j==0){
						    	str=ids[j][m%(names[j].length)];
							}else{
								str=str+"_"+ids[j][m%(names[j].length)];
							}
							
					    }
					if(tableSpec1[zz]=="item_"+str){
						ppd=true;
					}
			   }
		    }
		    if(!ppd){$("#"+tableSpec1[zz]).remove();}
	    }
	}
}
function deleteItem(rowNames){
	$(rowNames).parent().parent().remove();
}


function addStocks(){
	var stockCounts=0;
	$("input[name='stockCounts']").each(function(){
		 if($(this).val()!=""||$(this).val()!=null){ 
            stockCounts+=parseInt($(this).val());
		 }
	});
	$("#stockCount").val(stockCounts);
}

function addSales(){
	var saleCounts=0;
	$("input[name='saleCounts']").each(function(){
		 if($(this).val()!=""||$(this).val()!=null){ 
		    saleCounts+=parseInt($(this).val());
		 }
	});
	$("#saleCount").val(saleCounts);
}

function checkSubmit(){
	var els =document.getElementsByName("fashionSwitchPic").length;
	if(els<1){
		alert("请上传商品款式集图片");
		return;
	}
	
	 if($("#colorSize").val()=="true"){
		 if($("input[name='stockCounts']").length<=0){
			 alert("请开启颜色尺寸");
	         return;
		 }
		 var pd1=false;
		$("input[name='isDefaults']").each(function(){
			if($(this).val()=="true"){pd1=true;}
		});
		if(!pd1){alert("请选择默认款式！");return;}
		 var pd=false;
		$("input[name='stockCounts']").each(function(){
	        if($(this).val()==""||$(this).val()==null){pd=true;}
		});
		if(pd){alert("请必须填写款式库存");return;}
		$("input[name='saleCounts']").each(function(){
	        if($(this).val()==""||$(this).val()==null){ pd=true;}
		});
		if(pd){ alert("请必须填写款式销量"); return;}
		$("input[name='salePrices']").each(function(){
	        if($(this).val()==""||$(this).val()==null){ pd=true; }
		});
		if(pd){ alert("请必须填写款式 销售价"); return;}
		$("input[name='marketPrices']").each(function(){
	        if($(this).val()==""||$(this).val()==null){ pd=true; }
		});
		if(pd){ alert("请必须填写款式市场价");return;}
		$("input[name='costPrices']").each(function(){
	        if($(this).val()==""||$(this).val()==null){pd=true; }
		});
		if(pd){ alert("请必须填写款式成本价");return;}
	 }
		$("#jvForm").submit();
	}

function delFash(id,productId){
var messages;
var boo;
	$.post("o_delFashion.do",{id:id,productId:productId},function(data){
		messages=data.message;
		boo=data.boo;
                 alert(messages);
         if(boo==false){
             location.href=location.href;
             }
		},'json');
}
function optSearch() {
	$.post('v_search.jspx', {
		"correlationtypeId" : $("#correlationtypeId").val(),
		"correlationbrandId" : $("#correlationbrandId").val(),
		'correlationproductName' : $('#correlationproductName').val()
	}, function(data) {
		document.getElementById("select").options.length=0;
        var i=0;
        for(var key in data){
			var newoption=new Option(data[key],key);
			if (jsSelectIsExitItem(document.getElementById("correlationIds"), key)) {        
				document.getElementById("select").options[i]=newoption;
				i++;
		    }
        }
	}, 'json');
}
function optcombinationSearch() {
	$.post('v_combinationsearch.jspx', {
		"combinationtypeId" : $("#combinationtypeId").val(),
		"combinationbrandId" : $("#combinationbrandId").val(),
		'combinationproductName' : $('#combinationproductName').val()
	}, function(data) {
		document.getElementById("select").options.length=0;
        var i=0;
        for(var key in data){
			var newoption=new Option(data[key],key);
			if (jsSelectIsExitItem(document.getElementById("combinationIds"), key)) {        
				document.getElementById("combinationselect").options[i]=newoption;
				i++;
		    }
        }
	}, 'json');
}

function uploadPicsSuccess(file,data) {
	var jsonData=eval("("+data+")");//转换为json对象 
	if(jsonData.error!=null){
		$.alert("提示",jsonData.error);
	}else{
		addPicLine();
		var index = picIndex - 1;
		imgUrl=jsonData.imgUrl;
		$("#preImg"+index).attr("src","${uploadRoot}"+imgUrl);
		var imgSrc = parent.document.getElementById("preImg"+index);
		if(!$(imgSrc).attr("noResize")) {
			$(imgSrc).css("width","auto");
			$(imgSrc).css("height","auto");
		}
		$("#uploadImgPath"+index).val(imgUrl);
	}
}

</script>
<style type="text/css">
.ckl{padding-right:12px;}
.pn-ftable input ,.pn-ftable select{ border:1px solid #999999;}
.pn-fbutton{ padding-top:20px; padding-bottom:20px;}
</style>
</head>
<body>
[#include "../include/shop_top.html"/]
[#include "../common/image_upload.html"/]
[#include "../common/image_amp_upload.html"/]
[#include "../common/image_big_upload.html"/]
[#include "../common/image_switch_upload.html"/]
<div class="w1168">
	[#include "店铺中心_导航.html"/]
    <div class="user_right">
    	<div class="user_title2">出售中宝贝修改</div>
    	<div class="clear10"></div>
        [@p.productform id="jvForm" action="o_update.jspx" labelWidth="12" enctype="multipart/form-data"]
        <div class="demoWrapper">
        <div id="tabNav">
        <ul> 
        <li><a href="#tab1">基本信息</a></li>
        <!-- <li><a href="#tab2">相关商品</a></li> 
        <li><a href="#tab3">组合商品</a></li> --> 
        </ul>
        <div class="clr"></div>
        </div>		
        <div id="tabs">
        <div id="tab1" class="tab">
        <div id="demo1">
        <table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
        
        [#assign count=0/]
        [#list itemList as item]
        [#if !item.single][#assign count=count+1/][/#if]
        [#if !item.custom]
        [#if item.field=="name"]
        [@p.text label=item.propertyName name=item.field value=product.name size="40" required="true" class="required" maxlength="150" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="categoryId"]
        [@p.select label=item.propertyName name=item.field value=product.category.id list=categoryList listKey="id" listValue="name" listDeep="deep" required="true" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="brandId"]
        [@p.select label=item.propertyName name=item.field list=category.brands value=((product.brand!).id!) listKey="id" listValue="name" headerKey="" headerValue="global.none" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="price"]
        [#if !category.colorsize]
        [@p.td label=item.propertyName required="true" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"]
        [@s.m "product.marketPrice"/]: [@p.text name="marketPrice" value=product.marketPrice style="width:50px" class="required number"/] &nbsp;
        [@s.m "product.salePrice"/]: [@p.text name="salePrice" value=product.salePrice style="width:50px" class="required number"/] &nbsp;
        [@s.m "product.costPrice"/]: [@p.text name="costPrice" value=product.costPrice  style="width:50px" class="required number"/] &nbsp;
        [/@p.td] [#if count%2==0][@p.tr/][/#if]
        [/#if]
        [#elseif item.field="stockCount"]
        [#if !category.colorsize]
        [@p.text label=item.propertyName id=item.field name=item.field value=product.stockCount size="10"  required="true" class="required digits" maxlength="10"  help="" helpPosition="2" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [/#if]
        [#elseif item.field="attr"]
        [@p.td label=item.propertyName colspan=item.single?string("2","1") width="${item.single?string(100,50)}"]
        <label class="ckl">
        <input type="checkbox" onclick="$('#onSale').val(this.checked)"[#if product.onSale] checked="checked"[/#if]/>
        [@s.m "product.onSale"/]<input type="hidden" id="onSale" name="onSale" value="${product.onSale?string('true','false')}"/>
        </label>
        [/@p.td][#if count%2==0][@p.tr/][/#if]
        
        [@p.td label="product.yushou" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"]
        [#if product.yushou??][@p.radio name="yushou" list={"true":"是","false":"否"} value="${product.yushou?string('true','false')}"/] [/#if]&nbsp;<br/>[#if product.dingjin??]预售定金(元):<input  type="text" name="dingjin" class='number' value="${product.dingjin}"/>[/#if]&nbsp;&nbsp;[#if product.dingjin??]预售尾款(元):<input  type="text" name="weikuan" class='number' value="${product.weikuan!}"/>[/#if][#if product.yushoubegindate??] &nbsp;&nbsp;预售开始时间:<input type="text" id="yushoubegindate" name="yushoubegindate" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'yushouenddate\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${product.yushoubegindate}"/>[/#if][#if product.yushouenddate??]&nbsp;&nbsp;预售结束时间:<input type="text" id="yushouenddate" name="yushouenddate" onclick="WdatePicker({minDate:'#F{$dp.$D(\'yushoubegindate\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${product.yushouenddate}"/>[/#if]
        [#if product.weikuanbegindate??] &nbsp;&nbsp;付尾款开始时间:<input type="text" id="weikuanbegindate" name="weikuanbegindate" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'weikuanenddate\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${product.weikuanbegindate}"/>[/#if][#if product.weikuanenddate??] &nbsp;&nbsp;付尾款结束时间:<input type="text" id="weikuanenddate" name="weikuanenddate" onclick="WdatePicker({minDate:'#F{$dp.$D(\'weikuanbegindate\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${product.weikuanenddate}"/>[/#if][/@p.td][@p.tr/]
        [#elseif item.field="productKeywords"]
        [@p.text label=item.propertyName name="productKeywords" value=productKeywords! maxlength="255" help="product.keywords.help" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="weight"]
        [@p.text label=item.propertyName name="weight" value=product.weight! size="10" help="product.weight.help" class="digits" maxlength="10" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="score"]  
        [@p.text label=item.propertyName name="score" value=product.score maxlength="10" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="alertInventory"]   
        [@p.text label=item.propertyName name="alertInventory" value=product.alertInventory maxlength="10" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="tagIds"]  
        [@p.checkboxlist label=item.propertyName name="tagIds" valueList=product.tagIds  list=tagList listKey="id" listValue="name" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        
        
        
        [#elseif item.field="coverImg"]  
        [@p.td label=item.propertyName colspan="1" width="50" noHeight="true" required="true"]
        [@p.text id="uploadImgPath100" name="coverImg" value=product.productExt.coverImg size="30" class="required"/] 
        <input type="button" value="[@s.m "imageupload.clear"/]" onclick="clearImg(100);"/><br/>
        <span id="ufc100"><input type="file" id="uploadFile100" size="20"/></span> 
        <input type="button" value="[@s.m "imageupload.upload"/]" onclick="upload(100);"/><br/>
        <input type="hidden" id="zoomWidth100" value="100"/> 
        <input type="hidden" id="zoomHeight100" value="100" /> 
        [/@p.td]
        [@p.td colspan="1" width="50"]
        <img id="preImg100" alt="[@s.m "imageupload.preview"/>160*160" src="${uploadRoot!}${product.productExt.coverImg!}"  style="width:100px;height:100px;background-color:#CCCCCC;border:1px solid #333"/>
        [/@p.td][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="productstyle"] 
        
        
        <tr>
          <td width="100" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>商品款式集图片：</td>
        <td colspan="3" width="48%" class="pn-fcontent">
        
        <div>
        <span id="spanButtonPlaceHolder"></span>
        <span style="display: none;"><input class="cancel" id="btnCancel" type="button" value="取消" onclick="swfu.cancelQueue();" disabled="disabled" /></span>
        <div id="fsUploadProgress" style="display: none;"></div>
        </div>
        
        [#list product.pictures as pic]
        
        <table id="picTable${pic_index+3}" border="0" style="float:left;">
        <tr>
        <td>
        <div>
        <input type="text" id="uploadImgPath${pic_index+3}" name="fashionSwitchPic" value="${pic.picturePath!}" class="required" style="width:170px;"/>
        <a href="javascript:void(0);" onclick="$('#picTable${pic_index+3}').remove();" class="pn-opt">删除</a>
        </div>
        <div>
        <span id="ufc${pic_index+3}" style="position:relative">
        <input type="text" id="uploadFileText${pic_index+3}" size="10" />
        
        <input onchange="$('#uploadFileText${pic_index+3}').val(this.value)" size="10" type="file" id="uploadFile${pic_index+3}" class="file-button" />
        </span>
        <input type="button" value="上传" onclick="upload(${pic_index+3});" class="upload-button"/>
        </div>
        <!--<div><textarea style="width:200px;height:60px;" name="picDescs" maxlength="255">${p.description!}</textarea></div>-->
        </td>
        <td><img id="preImg${pic_index+3}" src="${uploadRoot!}${pic.picturePath!}" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333" /></td>
        </tr>
        </table>
        <input type="hidden" name="oldpicPaths" value="${pic.picturePath!}"/>
        [/#list]
        <div id="picBefore" style="clear:both"></div>
        
        
        
        <div id="picBefore" style="clear:both"></div>
        </td>
        </tr>
        [#list  map?keys as mykey]  
        [#assign mapUser=map[mykey]]  
        [#assign st=map1[mykey]]  
        [#if st.dataType==1]
        [@p.select name="exended_${st.field}"  required="true" class="required"  value=map2[st.field] label=st.name list=mapUser  listKey="id" listValue="name" colspan="2" width="100"  headerKey="" headerValue="global.none"/][@p.tr/]
        [#else]
        [@p.radio name="exended_${st.field}" required="true" class="required" value=map2[st.field] label=st.name list=mapUser listKey="id" listValue="name" colspan="2" width="100" /][@p.tr/]
        [/#if]
        [/#list]
        [#if category.colorsize]
        <tr id="channelIdsContainer">
        <td width="12%" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>规格：</td>
        <td colspan="3" width="88%" class="pn-fcontent">
        <input id="channel" type="button" value="开启规格"/>	
        <div id="channelDialog" title="规格列表" style="display:none;">
        <span id="channels">
        <div class="mc_content">
        <ul class="ysppm_rg_ul">
        [#list standardTypeList as standardType]
        <li [#if standardType_index=0]class="curr3"[#else]class="normaltab3"[/#if] id="tb_1${standardType_index+1}" onclick="HoverLi(1,'${standardType_index+1}','${standardTypeList?size}');">${standardType.name}</li>
        [/#list]  
        </ul>  
        </div>
        <div class="mc_content">
        [#list standardTypeList as standardType]
        <div id="tbc_1${standardType_index+1}" [#if standardType_index=0]class="dis"[#else]class="undis"[/#if]>
        [#list standardType.standardSet as standard]
        <input type="checkbox" id="${standardType.field!}" name="${standardType.field!}" value="${standard.id!}" nameAttr="${standard.name!}" 
        [#list psList as ps]
        [#if standard.id==ps.standard.id]checked="checked"[/#if]
        [/#list]
        />
        <span class="colorSize">${standard.name!}</span><br/>
        [/#list]
        </div>
        [/#list]
        </div>
        </span>
        </div>
        <div style="clear:both"></div>
        </td>
        </tr>
        [#list standardTypeList as standardType]
        [#if standardType.dataType]
        <tr id="${standardType.field}Container">
        <td width="12%" class="pn-flabel pn-flabel-h">${standardType.name}</td>
        <td colspan="3" width="88%" class="pn-fcontent">
        <table id="${standardType.field}ItemContainer" border="0" style="float: left;">
        <tr>
        [#list psList as ps]
        [#if standardType.id=ps.type.id]
        <td align="center">
        <input type="checkbox" id='${standardType.field}size' name='picture' onclick="standardAdd(this);" value="${ps.standard.id}" nameAttr="${ps.standard.name}" checked="checked"/>${ps.standard.name}
        </td>
        [/#if]
        [/#list]
        </tr>
        <tr>
        [#list psList as ps]
        [#if standardType.id=ps.type.id]
        <td align="center">
        <div>
        <img id="preImg${ps_index}" alt="43*43" src="${uploadRoot!}${ps.imgPath!}"  style="width:100px;height:100px;background-color:#CCCCCC;border:1px solid #333"/><br/>
        <input type='text' id="uploadImgPath${ps_index}" name="colorImg" value="${ps.imgPath!}" size="10" /><br/>
        <span id="ufc${ps_index}"><input type="file" id="uploadFile${ps_index}" size="2"/></span>
        <input type="hidden" id="zoomWidth${ps_index}" value="100"/> 
        <input type="hidden" id="zoomHeight${ps_index}" value="100" /> 
        <input type="button" value="上传" onclick="upload(${ps_index});"/>
        </div>
        </td>
        [/#if]
        [/#list]
        </tr>
        </table>
        </td>
        </tr>
        [#else]
        <tr id="${standardType.field}Container"><td width="12%" class="pn-flabel pn-flabel-h">${standardType.name}</td>
        <td colspan="3" width="88%" class="pn-fcontent">
        <span id="${standardType.field}ItemContainer">
        [#list psList as ps]
        [#if standardType.id=ps.type.id]
        <input type="checkbox" id='${standardType.field}size' name='character' onclick="standardAdd(this);" value="${ps.standard.id}" nameAttr="${ps.standard.name}" checked="checked"/>${ps.standard.name}&nbsp;&nbsp;
        [/#if]
        [/#list]
        </span>
        </td>
        </tr>
        [/#if]
        [/#list]
        <tr id="onlyFashion">
        <td width="12%" class="pn-flabel pn-flabel-h"></td>
        <td colspan="3" width="88%" class="pn-fcontent">
        <table id="tableSpec" cellspacing="0" cellpadding="5" border="0" class="tb-color">
        <tr id="it">
        <th align="center" width="60">默认款式</th>
        [#list standardTypeList as standardType]
        <th align="center" width="120">${standardType.name}</th>
        [/#list]
        <th align="center" width="120">商品库存</th>
        <th align="center" width="120">销售价</th>
        <th align="center" width="120">市场价</th>
        <th align="center" width="120">成本价</th>
        <th align="center" width="40">移除</th>
        </tr>
        
        
        [#list product.fashions as fash]
        <tr id="item_${fash.nature!}">
        <input type="hidden" value="${fash.id!}" name="fashId"/>
        <input type="hidden" name='nature' value="${fash.nature!}"/>
        <td align="center" width="60">
        <input type="radio" name="checkDefaults" onclick="clickchange('${fash.nature!}');" [#if fash.isDefault!] checked[/#if]/>
        <input type="hidden" id="isDefaultes${fash.nature!}" name="isDefaults" [#if fash.isDefault] value="true"[#else]value="false"[/#if]/>
        </td>
        [#list standardTypeList as standardType]
        <td align="center" width="100">                
        [#list fash.standards as standard]
        [#if standard.type.id=standardType.id]
        ${standard.name!}
        [/#if]
        [/#list]
        </td>
        [/#list]
        <td align="center" width="120"><input name="stockCounts" onchange="addStocks();" type="text" size="10" class="required digits" value="${fash.stockCount!}"/></td>
        <td align="center" width="120"><input name="salePrices" type="text"  size="10" class="required number" value="${fash.salePrice!}"/></td>
        <td align="center" width="120"><input name="marketPrices" type="text"  size="10" class="required number" value="${fash.marketPrice!}"/></td>
        <td align="center" width="120"><input name="costPrices" type="text"  size="10" class="required number" value="${fash.costPrice!}"/></td>
        <td align="center" width="40"><img src="../../../res/jspgou/img/admin/icon_delete.gif" onclick="deleteItem(this);"/></td>
        </tr>
        [/#list]
        <tr id="tbeSpec" style="display:none;"><td colspan="8" height="1"></td></tr>
        </table>
        </td>
        </tr>
        [/#if]
        [#elseif item.field="shareContent"]  
        [@p.textarea label=item.propertyName name="shareContent" value=product.shareContent!  rows="3" cols="70" maxlength="255" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="mtitle"] 
        [@p.text label=item.propertyName name="mtitle" value=product.mtitle! size="30" maxlength="255" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="mkeywords"] 
        [@p.text label=item.propertyName name="mkeywords" value=product.mkeywords! size="30" maxlength="255" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="mdescription"] 
        [@p.text label=item.propertyName name="mdescription" value=product.mdescription! size="60" maxlength="255" colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="text"]   
        [@p.ckeditor label=item.propertyName name="text" value=product.text! colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [#elseif item.field="text1"]  
        [@p.ckeditor label=item.propertyName name="text1" value=product.text1! colspan=item.single?string("2","1") width="${item.single?string(100,50)}"/][#if count%2==0][@p.tr/][/#if]
        [/#if]
        [#else]
        [@p.selfDefineWidget name="attr_${item.field}" value=product.attr[item.field] list="${item.optValue!}"  rows="${item.rows!}" cols="${item.cols!}" label=item.propertyName colspan=item.single?string("2","1") width="${item.single?string(100,50)}" type="${item.dataType}"/][#if count%2==0][@p.tr/][/#if]
        [/#if]
        [/#list]
        
        
        [@p.td colspan="2"]
        [@p.hidden name="ctgId" value=ctgId!/]
        [@p.hidden name="id" value=product.id/]
        <input type="hidden" name="colorSize" id="colorSize" [#if product.category.colorsize] value="true"[#else] value="false"[/#if] />
        <input type="button" value="提交" onclick="checkSubmit();" class="menu_ok"/>&nbsp; [@p.reset code="global.reset"/]
        [/@p.td]
        </table>
        </div>
        </div>
        
        <div id="tab2" class="tab">
        <div id="demo2"> 
        <table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
        [@p.td colspan="2"]商品搜索：
        <select id="correlationtypeId" name="correlationtypeId"><option value="">--所有分类--</option>
        [#list typeList as productType]
        <option value="${productType.id}"[#if typeId??] [#if typeId==productType.id]selected="selected"[/#if][/#if]>${productType.name!}</option>
        [/#list]  
        </select>
        <select id="correlationbrandId" name="correlationbrandId"><option value="">--所有品牌--</option>
        [#list brandList as brand]
        <option value="${brand.id}"[#if brandId??] [#if brandId==brand.id]selected="selected"[/#if][/#if]>${brand.name!}</option>
        [/#list]
        </select>
        <input id="correlationproductName" type="text" name="correlationproductName" value="${correlationproductName!}" style="width:100px"/>
        <input type="button" value="[@s.m "global.query"/]" onclick="optSearch();"/>
        [/@p.td]
        [@p.tr/]
        [@p.td colspan="2"]
        <table width="500" align="center" border="0" cellpadding="0" cellspacing="0" class="newContTab">
        <tr>
        <td>
        <div>
        <div>
        <select multiple="multiple" id="select" style="width:210px;height:200px; float:left; border:1px #A0A0A4 outset; padding:1px; ">
        </select>
        </div>
        <div style="float:left;width:60px"> <span id="add">
        <input type="button" class="btn" value=">"/>
        </span><br />
        <span id="add_all">
        <input type="button" class="btn" value=">>"/>
        </span> <br />
        <span id="remove">
        <input type="button" class="btn" value="<"/>
        </span><br />
        <span id="remove_all">
        <input type="button" class="btn" value="<<"/>
        </span> </div>
        <div>
        <select name="correlationIds" multiple="multiple" id="correlationIds" style="width: 210px;height:200px; float:lfet;border:1px #A0A0A4 outset; padding:1px;">
        [#list product.correlations as correlation]
        <option value="${correlation.id}">${correlation.name!}</option>
        [/#list]
        </select>
        </div>
        </div></td>
        </tr>
        </table>
        <input type="hidden" id="rightlist" name="rightlist">
        [/@p.td]
        [@p.tr/]
        [@p.td colspan="2"][@p.submit code="global.submit"/] &nbsp; [@p.reset code="global.reset"/][/@p.td]		
        </table>
        </div>
        </div>
        <div id="tab3" class="tab">
        
        <div id="demo3"> 
        <table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
        [@p.td colspan="2"]商品搜索：
        <select id="combinationtypeId" name="combinationtypeId"><option value="">--所有分类--</option>
        [#list typeList as productType]
        <option value="${productType.id}"[#if typeId??] [#if typeId==productType.id]selected="selected"[/#if][/#if]>${productType.name!}</option>
        [/#list]
        </select>
        <select id="combinationbrandId" name="combinationbrandId"><option value="">--所有品牌--</option>
        [#list brandList as brand]
        <option value="${brand.id}"[#if brandId??] [#if brandId==brand.id]selected="selected"[/#if][/#if]>${brand.name!}</option>
        [/#list]
        </select>
        <input id="combinationproductName" type="text" name="combinationproductName" value="${combinationproductName!}" style="width:100px"/>
        <input type="button" value="[@s.m "global.query"/]" onclick="optcombinationSearch();"/>
        [/@p.td]
        [@p.tr/]
        [@p.td colspan="2"]
        <table width="500" align="center" border="0" cellpadding="0" cellspacing="0" class="newContTab">
        <tr>
        <td>
        <div>
        <div>
        <select multiple="multiple" id="combinationselect" style="width:210px;height:200px; float:left; border:1px #A0A0A4 outset; padding:1px; ">
        </select>
        </div>
        <div style="float:left;width:60px"> <span id="combinationadd">
        <input type="button" class="btn" value=">"/>
        </span><br />
        <span id="combinationadd_all">
        <input type="button" class="btn" value=">>"/>
        </span> <br />
        <span id="combinationremove">
        <input type="button" class="btn" value="<"/>
        </span><br />
        <span id="combinationremove_all">
        <input type="button" class="btn" value="<<"/>
        </span> </div>
        <div>
        <select name="combinationIds" multiple="multiple" id="combinationIds" style="width: 210px;height:200px; float:lfet;border:1px #A0A0A4 outset; padding:1px;">
        [#list product.combinations as combination]
        <option value="${combination.id}">${combination.name!}</option>
        [/#list]
        </select>
        </div>
        </div></td>
        </tr>
        </table>
        <input type="hidden" id="combinationrightlist" name="combinationrightlist">
        [/@p.td]
        [@p.tr/]
        [@p.td colspan="2"][@p.submit code="global.submit"/] &nbsp; [@p.reset code="global.reset"/][/@p.td]
        </table>
        </div>
        
        </div>
        </div>
        
        </div>      
        [/@p.productform]
        <!-- 商品款式集模板 -->
        <textarea id="picTable" style="display:none;">
        <table id="picTable{0}" border="0" style="float:left;">
        <tr>
        <td>
        <div>
        <input type="text" id="uploadImgPath{0}" name="fashionSwitchPic" class="required" style="width:160px"/> 
        <a href="javascript:void(0);" onclick="$('#picTable{0}').remove();" class="pn-opt">删除</a>
        </div>
        <div>
        <span id="ufc{0}" style="position:relative">
        <input type="text" id="uploadFileText{0}" size="10"/>  
        
        <input onchange="$('#uploadFileText{0}').val(this.value)" size="10" type="file" id="uploadFile{0}" class="file-button"/>
        </span> 
        <input type="button" value="上传" onclick="upload({0});" class="upload-button"/>
        </div>
        <!--<div>&lt;textarea style="width:200px;height:60px;" name="picDescs" maxlength="255"&gt;&lt;/textarea&gt;</div>-->
        </td>
        <td><img id="preImg{0}" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333"/></td>
        </tr>
        </table>
        </textarea>
        <script type="text/javascript">
        var picIndex = ${product.pictures?size} + 5;
        var picTpl = $.format($("#picTable").val());
        function addPicLine() {
        $("#picBefore").before(picTpl(picIndex++));
        }
        </script> 
    </div>
	<div class="clear20"></div>
</div>
[#include "../include/footer_information_bar.html"/]
</body>
</html>